package LeetCode;

/**
 * @author VX5
 * @Title: MJC
 * @ProjectName interview
 * @Description: TODO
 * @date ${DAT}17:42
 */
public class LeetCode62I {
    int count = 0;
    public int uniquePaths(int m, int n) {
        int[][] board = new int[m][n];
        // 动态规划的做法
        // 首先对路的初始化， 当只有一行或者一列时
        for (int i = 0; i < m; i++){
            board[i][0] = 1;
        }
        for (int i = 0; i < n; i++){
            board[0][i] = 1;
        }
        //进行动态规划
        for (int i = 1; i < m; i++){
            for (int j = 1; j < n; j++){
                board[i][j] = board[i - 1][j] + board[i][j - 1];
            }
        }
        return board[m - 1][n - 1];
    }



    public static void main(String[] args) {
        System.out.println(new LeetCode62I().uniquePaths(3, 2));
    }
}
